*************************************************************************
*																		*
*					Campaign Panel Book Chapter 6 - Long Format			*
*																		*
*************************************************************************	

use "${data}\ZA5305_en_v5-0-0.dta", clear

keep lfdn teilnahme w1

rename w1 teil_w1


// Adding the operationalized variables

cd "${path}\Reproducible Do-Files\Chapter 6\Data"

merge 1:1 lfdn using choice09
drop _merge

merge 1:1 lfdn using komm_variablen09
drop _merge

merge 1:1 lfdn using michigan09
drop _merge

*********************************************************************************
** 
** I. Transform into long (panel-)format
**
*********************************************************************************

reshape long wabsa ///
   parta0 parta1 parta4 parta5 parta6 parta7  ///
   tvduell1 tvduell4 tvduell_su1 tvduell_su4 tvduell_md1 tvduell_md4  ///
   gespr1 gespr4  gespr5 gespr6 gespr7 ///
   pk_gesamtin1 pk_gesamtin4 pk_gesamtin5 pk_gesamtin6 pk_gesamtin7 ///
   koagk koasge koarg koarrg koasgr ///
   regzufr kand1 kand4 kand5 kand6 kand7  ///
   komp1 komp4 komp5 komp6 komp7 ///
   ewl awl, ///
   i(lfdn) j(welle)
   
   
 ***********************************************************************
 **	Wave dummies
 *******************************************************************


 tab welle, gen(w)
 
save "${path}\Reproducible Do-Files\Chapter 6\Data\longformat09.dta", replace
